home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
9-Digit Zip Code Directory
/
9-Digit Zip Code Directory (American Business Information) (ABIZIP-12).ISO
/
z4src.zip
/
CLAPP.CPP
< prev
next >
Wrap
C/C++ Source or Header
|
1993-08-26
|
8KB
|
249 lines
//----------------------------------------------------------------------------
// MODULE DESCRIPTION
//
// Module: clapp.cpp
// Title: C++ Class Libraries
// Notice: John M. Weeder
// Copyright (c) 1993. All rights reserved.
// This module contains proprietary information and should be
// treated as confidential.
//
//----------------------------------------------------------------------------
// MAINTENANCE HISTORY
//
// $Workfile$
// $Revision$
// $Author$
// $Date$
// $Log$
//
//----------------------------------------------------------------------------
// MODULE NARRATIVE
//
// This module contains code for the class CL_APP.
//
// The code in this module may be written in C++ or C.
//
// This module is portable to:
// DOS 3.X+
// MS Windows 3.X+
// OS/2 2.X+
// OS/2 2.0 PM
//
// The following compilers are supported:
// MSC 6.0A
// MSC/C++ 7.0
// Borland C++ 3.1 for DOS
// Borland C++ 1.0 for OS/2 2.X
//
//----------------------------------------------------------------------------
#include <class.hpp>
//----------------------------------------------------------------------------
// Description: Default constructor
// Parameters:
// Returns:
//----------------------------------------------------------------------------
FN_M CL_APP::CL_APP()
{
CL_APP::Initialize(CL_INIT_CLASS);
}
//----------------------------------------------------------------------------
// Description: Copy constructor
// Parameters: rccl_app Reference to object to copy.
// Returns:
//----------------------------------------------------------------------------
FN_M CL_APP::CL_APP(RCCL_APP rccl_app)
{
CL_APP::Initialize(CL_INIT_CLASS);
*this = rccl_app;
}
//----------------------------------------------------------------------------
// Description: Destructor
// Parameters:
// Returns:
//----------------------------------------------------------------------------
FN_M CL_APP::~CL_APP()
{
CL_APP::Destroy(FALSE);
}
//----------------------------------------------------------------------------
// Description: Destroy object. Free any resources used by object.
// Normally called by destructor.
// Should allow multiple calls from various classes.
// Parameters: fDestroyAll Destroy parents also?
// Default is TRUE.
// Returns: TRUE if successful.
//----------------------------------------------------------------------------
BOOL FN_M CL_APP::Destroy(BOOL fDestroyAll)
{
CL_APP::Initialize(CL_INIT_CLASS_VARS);
if (fDestroyAll) // Destroy parent.
CL_APP_PARENT::Destroy(fDestroyAll);
return TRUE;
}
//----------------------------------------------------------------------------
// Description: Initialize object.
// Normally called by constructor.
// Should allow multiple calls from various classes.
// Parameters: sInit Initialization code. May be one of the following:
// CL_INIT_CLASS Reset class variables and
// and dynamic allocations for
// this class only.
// CL_INIT_CLASS_VARS Reset class variables for
// this class only.
// CL_INIT_VARS Reset class variables for
// this class only.
// CL_INIT_ALL Initialize class and all
// parent class, including
// dynamic memory allocation.
// Default is CL_INIT_ALL
// Returns: TRUE if successful.
//----------------------------------------------------------------------------
BOOL FN_M CL_APP::Initialize(SHORT sInit)
{
if (sInit == CL_INIT_VARS || sInit == CL_INIT_ALL)
CL_APP_PARENT::Initialize(sInit);
return TRUE;
}
//----------------------------------------------------------------------------
// Description: Assignment operator
// NOTE: Don't copy object into self
// Parameters: rccl_app Reference to right value.
// Returns: Reference to new object.
//----------------------------------------------------------------------------
RCCL_APP FN_M CL_APP::operator=(RCCL_APP rccl_app)
{
if (this != &rccl_app)
{
Invalid("CL_APP::operator=");
}
return (RCCL_APP)*this;
}
//----------------------------------------------------------------------------
// Description: Retrieve object from persistent storage
// Parameters: pcsz Name of object.
// pcszSub Sub-name of object.
// The first character of the name should be '~'.
// If NULL, no sub name is available.
// Default is NULL
// Returns: TRUE if successful.
//----------------------------------------------------------------------------
BOOL FN_M CL_APP::Retrieve(PCSZ pcsz, PCSZ pcszSub)
{
Assert(pcsz);
// Create sub-name for object
CL_STRING string("%s~CL_APP", (pcszSub ? pcszSub: ""));
if (string.IsError())
return FALSE;
// Get parent
if (!CL_APP_PARENT::Retrieve(pcsz, (PCSZ)string))
return FALSE;
return !IsError();
}
//----------------------------------------------------------------------------
// Description: Store object to persistent storage
// Parameters: pcsz Name of object.
// pcszSub Sub-name of object.
// The first character of the name should be '~'.
// If NULL, no sub name is available.
// Default is NULL
// Returns: TRUE if successful.
//----------------------------------------------------------------------------
BOOL FN_M CL_APP::Store(PCSZ pcsz, PCSZ pcszSub)
{
Assert(pcsz);
if (IsError()) // Check that object is valid
return FALSE;
// Create sub-name for object
CL_STRING string("%s~CL_APP", (pcszSub ? pcszSub: ""));
if (string.IsError())
return FALSE;
// Store parent
if (!CL_APP_PARENT::Store(pcsz, (PCSZ)string))
return FALSE;
return !IsError();
}
//----------------------------------------------------------------------------
// Description: Print object value to debugging output.
// Parameters: pccl_app Pointer to dynamic object.
// If NULL, static data elements are printed.
// Default is NULL.
// pcsz Name of object.
// If NULL, no name is displayed.
// Default is NULL.
// cLevel Display level.
// Default is zero.
// Returns:
//----------------------------------------------------------------------------
#if COMPILE_DEBUG
VOID FN_M CL_APP::Print(PCCL_APP pccl_app, PCSZ pcsz, SIZET cLevel)
{
#if COMPILE_TEST
OutputL(cLevel, "CL_APP%s%s", (pcsz?"::":""), (pcsz?pcsz:""));
cLevel++;
if (pccl_app)
{
Output(" <%p>\n", pccl_app);
if(!pccl_app->IsError())
{
// OutputL(cLevel, " = %d\n", pccl_app->);
}
}
else
Output(" <NULL>\n");
CL_APP_PARENT::Print((CL_APP_PARENT _FAR_ *)pccl_app, pcsz, cLevel);
return ;
#else
NOTUSED(cLevel);
NOTUSED(pccl_app);
NOTUSED(pcsz);
return ;
#endif
}
#endif
//----------------------------------------------------------------------------
// Description: Run standard test suite on object.
// Parameters: sTest Test to run.
// If 0, run default tests.
// Default is 0.
// Returns: TRUE if successful.
//----------------------------------------------------------------------------
#if COMPILE_DEBUG
BOOL FN_M CL_APP::Test(SHORT sTest)
{
#if COMPILE_TEST
NOTUSED(sTest);
return TRUE;
#else
NOTUSED(sTest);
return TRUE;
#endif
}
#endif
//----------------------------------------------------------------------------
//------------------------------- End of File --------------------------------
//----------------------------------------------------------------------------